<template>
  <div>
    <!-- 指导 -->
    <!-- 登录的时候需要判断是否是第一次登录，如果是就先让用户操作这个引导页面 -->
    <div class="guidance">
      <div @click="guidanceClick(count)">
        <img :src="src" mode="scaleToFill" />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  components: {},
  data () {
    return {
      loginState: '',
      count: 1,
      // src: 'https://akk.028wkf.cn/kdb-weapp-img/compressed/zd1.jpg'
      src: 'https://akk.028wkf.cn/kdb-weapp-img/new-kdb-xcx/img/yd1.png'
    }
  },
  onShow () {
    this.isOneLogin()
    this.count = 1
  },
  created () {},
  methods: {
    guidanceClick (val) {
      const vm = this
      if (vm.count < 2) {
        vm.count++
        vm.src = `https://akk.028wkf.cn/kdb-weapp-img/new-kdb-xcx/img/yd${
          vm.count
        }.png`
      } else {
        vm.getCookieState()
        wx.switchTab({
          url: '/pages/home/index/main'
        })
      }
    },
    getCookieState () {
      this.$cookie.set('loginState', true)
    }, // 存一次用户是否第一次登录
    isOneLogin () {
      const vm = this
      let loginState = vm.$cookie.get('loginState')
      console.log(loginState)
      if (loginState) {
        vm.$router.new('/pages/login/login/main')
      } else {
        vm.$cookie.set('loginState', true)
      }
    }
  }
}
</script>

<style lang="scss">
.guidance {
  position: fixed;
  z-index: 99;
  top: 0;
  height: 100%;
  div {
    width: 375px;
    height: 100%;
    img {
      width: 375px;
      height: 100%;
    }
  }
}
</style>

